//
// Created by bjliuyong on 2021/6/7.
//

#include "memory_pool.h"

MemoryPool::~MemoryPool() {
    INFO_PRINT("[~MemoryPool] in %s\n",__FILE_NAME__);
    list<MemoryChunk*>::iterator  iter;
    for(iter = m_chunks.begin(); iter != m_chunks.end(); iter++){
        MemoryChunk* m_chunk = *iter;
        delete m_chunk;
    }
}

MemoryChunk * MemoryPool::new_chunk(uint mem_size) {
    MemoryChunk* chunk = new MemoryChunk(mem_size,__FILE_NAME__,__LINE__);
    m_chunks.push_front(chunk);
    return chunk;
}

